<div class="row">
  <div class="col-xs-12">
    <%= render partial: 'common/nav', locals: {show_tab: :show, model_nav_name: :admin_role, pjax: false} %>
    <div class="form-horizontal form-show" id="admin_role">
          <div class="form-group">
            <label class="control-label col-xs-12 col-sm-3"><%= t 'activerecord.attributes.role.name' %></label>
            <div class="col-xs-12 col-sm-9">
              <div class="clearfix">
                    <input type="text" readonly="readonly" class="col-xs-12 col-sm-6" value="<%= @role.name %>">
              </div>
            </div>
          </div>
          <div class="form-group">
            <label class="control-label col-xs-12 col-sm-3"><%= t 'activerecord.attributes.role.description' %></label>
            <div class="col-xs-12 col-sm-9">
              <div class="clearfix">
                    <input type="text" readonly="readonly" class="col-xs-12 col-sm-6" value="<%= @role.description %>">
              </div>
            </div>
          </div>
          <div class="form-group">
            <label class="control-label col-xs-12 col-sm-3"><%= t 'activerecord.attributes.role.position' %></label>
            <div class="col-xs-12 col-sm-9">
              <div class="clearfix">
                    <input type="text" readonly="readonly" class="col-xs-12 col-sm-6" value="<%= @role.position %>">
              </div>
            </div>
          </div>
    </div>
  </div>
</div>
<div class="row">
  <div class="base-border">
    <label class="base-border-after"><%= t 'activerecord.attributes.role.permissions' %></label>
    <% if @permissions.present? #角色权限 %>
        <table class="table table-striped table-hover">
          <thead>
          <tr>
            <td><%= t 'activerecord.attributes.defaults.id' %></td>
            <td><%= t 'activerecord.attributes.permission.description' %></td>
            <td><%= t 'activerecord.attributes.permission.group' %></td>
          </tr>
          </thead>
          <tbody>
          <% @permissions.each do |permission| %>
              <tr>
                <td><%= permission.id %></td>
                <td><%= permission.description %></td>
                <td><%= permission.group_name %></td>
              </tr>
          <% end %>
          </tbody>
        </table>
    <% else %>
        暂无权限
    <% end %>
  </div>
</div>
<script>
    $(function () {
        $('.nav.nav-list li.active').removeClass('active');
        $('.nav.nav-list li[data-model="role_list"]').addClass('active');
    } );
</script>
